<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Orbiter is a bootstrap minimal & clean admin template">
    <meta name="keywords" content="chat, chat platform, discussion, video call, voice call, communication, conversation, messange, messanger, talk">
    <meta name="author" content="Themesbox">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>Orbiter - Bootstrap Minimal & Clean Admin Template</title>
    <!-- Fevicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico">
    <!-- Start css -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css">
    <link href="assets/css/style.css" rel="stylesheet" type="text/css">
    <link href="assets/css/layui.css">
    <!-- End css -->
</head>
<body class="vertical-layout">
    <!-- Start Containerbar -->
    <div id="containerbar" class="containerbar authenticate-bg">
        <!-- Start Container -->
        <div class="container">
            <div class="auth-box login-box">
                <!-- Start row -->
                <div class="row no-gutters align-items-center justify-content-center">
                    <!-- Start col -->
                    <div class="col-md-6 col-lg-5">
                        <!-- Start Auth Box -->
                        <div class="auth-box-right">
                            <div class="card">
                                <div class="card-body">
                                    <form action="#" id="mayform">
                                        <div class="form-head">
                                            <a class="logo"><img src="assets/images/logo.svg" class="img-fluid" alt="logo"></a>
                                        </div>
                                        <h4 class="text-primary my-4">登 录 !</h4>
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="username" name="username" placeholder="用户名" required>
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="password" minlength="6" name="password"  placeholder="密码" required>
                                        </div>
                                        <div class="form-group">
                                            <div class="row">
                                                <div class="col-sm-9">
                                                    <input type="text" class="form-control" id="code" name="code"  maxlength="4" placeholder="验证码" required>
                                                </div>
                                                <div class="col-sm-1">
                                                    <img border="0" style="cursor:pointer" alt="验证码" onclick="getimgcode()"  id="verifyImg">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-row mb-3">
                                            <div class="col-sm-6">
                                                <div class="custom-control custom-checkbox text-left">
                                                  <input type="checkbox" class="custom-control-input" id="rememberme">
                                                  <label class="custom-control-label font-14" for="rememberme">记住密码</label>
                                                </div>
                                            </div>
                                            <div class="col-sm-6">
                                              <div class="forgot-psw">
                                                <a id="forgot-psw" href="forgotpsw.html" class="font-14">忘记密码</a>
                                              </div>
                                            </div>
                                        </div>
                                        <button class="btn btn-success btn-lg btn-block font-18 submit">登 录</button>
                                    </form>
                                    <p class="mb-0 mt-3">没有账户? <a href="register.html">注册账户</a></p>
                                </div>
                            </div>
                        </div>
                        <!-- End Auth Box -->
                    </div>
                    <!-- End col -->
                </div>
                <!-- End row -->
            </div>
        </div>
        <!-- End Container -->
    </div>
    <!-- End Containerbar -->
    <!-- Start js -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/popper.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.validate.min.js"></script>
    <script src="assets/js/messages_cn.js"></script>
    <script src="assets/js/modernizr.min.js"></script>
    <script src="assets/js/detect.js"></script>
    <script src="assets/js/jquery.slimscroll.js"></script>
    <script src="cim/httpUtils.js"></script>
    <script src="cim/baseUtils.js"></script>
    <script src="assets/layer/layer.js"></script>
    <script src="cim/jquerySession.js"></script>
    <!-- End js -->
    <script>
        uuid = generateUUID();
        $("#verifyImg").attr("src",baseUrl+"getVerifyCode?uuid="+uuid+"&t=" + Math.random());
        //点击登录按钮
        $("#mayform").validate({
            submitHandler:function(a){
                fun_loading(!0)
                let data = {
                    "account": $("#username").val(),
                    "password": $("#password").val(),
                    "uuid":uuid,
                    "code":$("#code").val()
                }
                http.post({url:baseUrl+'login',data:data},function(err,result){
                    console.log(result)
                    debugger
                    if(result.code == 0){
                        $.session.set('access_token',result.data.token);
                        $.session.set('userId', result.data.userId);
                        window.location.href = "index.html";
                    }else{
                        layer.msg(result.msg);
                        getimgcode();
                    }
                    fun_loading(!1)
                });
            }
        });
        //获取验证码
        function getimgcode(){
            $("#verifyImg").attr("src",baseUrl+"getVerifyCode?uuid="+uuid+"&t=" + Math.random());
        }
    </script>
</body>
</html>
